﻿<ResourceDictionary 
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:ctrl="using:RockHopper.TrainingCalculator.WinRT.Controls">

    <Style TargetType="ctrl:TileControl">
        <Setter Property="Width" Value="100"/>
        <Setter Property="Height" Value="100"/>
        <Setter Property="FontSize" Value="12"/>
        <Setter Property="FontWeight" Value="Bold"/>
        <Setter Property="HorizontalAlignment" Value="Center"/>
        <Setter Property="Margin" Value="5"/>
        <Setter Property="Padding" Value="5"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ctrl:TileControl">
                    <Grid Name="GridPart" Background="{TemplateBinding Background}">
                        <Grid.RowDefinitions>
                            <RowDefinition/>
                            <RowDefinition Height="30"/>
                        </Grid.RowDefinitions>
                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup x:Name="TapStates">
                                <VisualState x:Name="Normal" />
                                <VisualState x:Name="PointerDown">
                                    <Storyboard>
                                        <PointerDownThemeAnimation TargetName="GridPart" />
                                    </Storyboard>
                                </VisualState>
                                <VisualState x:Name="PointerUp">
                                    <Storyboard>
                                        <PointerUpThemeAnimation TargetName="GridPart" />
                                    </Storyboard>
                                </VisualState>
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>
                        <Canvas
                            Grid.Row="0"
                            Name="CanvasPart"
                            Background="Transparent"
                            Width="{TemplateBinding Width}" 
                            Height="{TemplateBinding Height}" >
                            <Image 
                                Canvas.Left="0"
                                Canvas.Top="0"
                                Name="ImagePart"
                                Width="{TemplateBinding Width}" 
                                Height="{TemplateBinding Height}" 
                                Stretch="None"/>

                            <Grid
                                Canvas.Left="0"
                                Canvas.Top="{TemplateBinding Height}"
                                Width="{TemplateBinding Width}"
                                Height="{TemplateBinding Height}"
                                HorizontalAlignment="Center"
                                VerticalAlignment="Center">
                                <TextBlock
                                    Name="LiveTileInfoTextBlock"
                                    HorizontalAlignment="Center"
                                    VerticalAlignment="Center"
                                    Text="{Binding LiveTileInfo}"
                                    FontSize="18"/>
                            </Grid>
                        </Canvas>
                        <TextBlock 
                            Grid.Row="1"
                            Text="{Binding Label}"
                            HorizontalAlignment="Center"
                            VerticalAlignment="Top"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ctrl:VdotPopupControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ctrl:VdotPopupControl">
                    <Grid
                        Margin="10"
                        Background="{StaticResource PopupBackgroundBrush}">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="50"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <RadioButton
                            Grid.Row="0"
                            Grid.Column="0"
                            Name="VdotModeToggleButtonPart"
                            Content="VDOT"
                            GroupName="CalculationMode"/>
                        <RadioButton
                            Grid.Row="0"
                            Grid.Column="1"
                            Name="RaceTimeModeToggleButtonPart"
                            Content="Race Time"
                            GroupName="CalculationMode"/>
                        <ctrl:VdotControl
                            Grid.Row="1"
                            Grid.ColumnSpan="2"
                            Name="VdotSliderPart"
                            VerticalAlignment="Top"/>

                        <ctrl:RacePerformanceControl
                            Grid.Row="1"
                            Grid.ColumnSpan="2"
                            Name="RacePerformanceSliderPart"/>
                        <ctrl:InfoControl  
                            Grid.Row="2"
                            Grid.ColumnSpan="2"
                            InfoKey="VdotInfo"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ctrl:VdotControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ctrl:VdotControl">
                    <Grid
                        VerticalAlignment="Center">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <TextBlock 
                            Grid.Row="0"
                            Text="VDOT" 
                            Style="{StaticResource LabelTextBlockStyle}"/>
                        <TextBlock 
                            Grid.Row="0"
                            Grid.Column="1"
                            Name="TextBlockPart"
                            HorizontalAlignment="Right"
                            Style="{StaticResource LabelTextBlockStyle}"/>
                        <Slider 
                            Grid.Row="1"
                            Grid.ColumnSpan="2"
                            Name="SliderPart" 
                            Minimum="30" 
                            Maximum="85" 
                            StepFrequency="0.1"
                            Orientation="Horizontal"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ctrl:RacePerformanceControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ctrl:RacePerformanceControl">
                    <Grid
                        VerticalAlignment="Center">
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                            <RowDefinition Height="Auto"/>
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition/>
                            <ColumnDefinition/>
                        </Grid.ColumnDefinitions>
                        <StackPanel
                            Grid.Row="0"
                            Grid.ColumnSpan="2"
                            Orientation="Horizontal">
                            <TextBox 
                                InputScope="Number"
                                Name="DistancePart"
                                Width="150"
                                Style="{StaticResource ValueTextBoxStyle}"/>
                            <StackPanel
                                Orientation="Horizontal">
                                <RadioButton
                                    Name="KilometresButtonPart"
                                    Content="Kilometres"
                                    GroupName="Units"
                                    Width="100"/>
                                <RadioButton
                                    Name="MetresButtonPart"
                                    Content="Metres"
                                    GroupName="Units"
                                    Width="100"/>
                                <RadioButton
                                    Name="MilesButtonPart"
                                    Content="Miles"
                                    GroupName="Units"
                                    Width="100"/>
                                <Button
                                    Name="UpdateButtonPart"
                                    Content="Update VDOT"
                                    Width="200"/>
                            </StackPanel>
                        </StackPanel>
                        <TextBlock 
                            Grid.Row="1"
                            Text="HOURS" 
                            Style="{StaticResource LabelTextBlockStyle}"/>
                        <Slider 
                            Grid.Row="2"
                            Grid.ColumnSpan="2"
                            Name="HourSliderPart" 
                            Minimum="0" 
                            Maximum="23" 
                            StepFrequency="1"
                            Padding="10,0,10,0"
                            Orientation="Horizontal"/>
                        <TextBlock 
                            Grid.Row="1"
                            Grid.Column="1"
                            Name="HourTextBlockPart"
                            HorizontalAlignment="Right"
                            Style="{StaticResource LabelTextBlockStyle}"/>
                        <TextBlock 
                            Grid.Row="3"
                            Text="MINUTES" 
                            Style="{StaticResource LabelTextBlockStyle}"/>
                        <Slider 
                            Grid.Row="4"
                            Grid.ColumnSpan="2"
                            Name="MinuteSliderPart" 
                            Minimum="0" 
                            Maximum="59" 
                            StepFrequency="1"
                            Padding="10,0,10,0"
                            Orientation="Horizontal"/>
                        <TextBlock 
                            Grid.Row="3"
                            Grid.Column="1"
                            Name="MinuteTextBlockPart"
                            HorizontalAlignment="Right"
                            Style="{StaticResource LabelTextBlockStyle}"/>
                        <TextBlock 
                            Grid.Row="5"
                            Text="SECONDS" 
                            Style="{StaticResource LabelTextBlockStyle}"/>
                        <Slider 
                            Grid.Row="6"
                            Grid.ColumnSpan="2"
                            Name="SecondSliderPart" 
                            Minimum="0" 
                            Maximum="59" 
                            StepFrequency="1"
                            Padding="10,0,10,0"
                            Orientation="Horizontal"/>
                        <TextBlock 
                            Grid.Row="5"
                            Grid.Column="1"
                            Name="SecondTextBlockPart"
                            HorizontalAlignment="Right"
                            Style="{StaticResource LabelTextBlockStyle}"/>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ctrl:PopupControl">
        <Setter Property="HorizontalContentAlignment" Value="Center"/>
        <Setter Property="VerticalContentAlignment" Value="Center"/>
         <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ctrl:PopupControl">
                    <Popup
                        Name="PopupPart">
                        <Border
                            CornerRadius="5"
                            BorderThickness="5"
                            Width="{TemplateBinding Width}"
                            Height="{TemplateBinding Height}"
                            BorderBrush="{StaticResource PopupBackgroundBrush}"
                            Background="{StaticResource PopupBackgroundBrush}">
                            <Grid>
                                <Grid.RowDefinitions>
                                    <RowDefinition Height="30"/>
                                    <RowDefinition/>
                                    <RowDefinition Height="70"/>
                                </Grid.RowDefinitions>
                                <Border
                                    Grid.Row="0"
                                    CornerRadius="5"
                                    BorderThickness="1"
                                    BorderBrush="{StaticResource PopupBackgroundBrush}"
                                    Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
                                    <TextBlock 
                                        Grid.Row="0"
                                        Name="TitleTextPart"
                                        FontSize="16"
                                        FontWeight="Bold"
                                        HorizontalAlignment="Center"
                                        VerticalAlignment="Center"
                                        Margin="10,2,0,2"/>
                                </Border>
                                
                                <ContentPresenter
                                    Grid.Row="1"/>
                                <Border
                                    Grid.Row="2"
                                    CornerRadius="5"
                                    BorderThickness="1"
                                    BorderBrush="{StaticResource PopupBackgroundBrush}"
                                    Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
                                    <Button
                                        Name="CloseButtonPart"
                                        Content="Close"
                                        Margin="20,5,20,5"
                                        HorizontalAlignment="Center"/>
                                </Border>
                                
                            </Grid>
                        </Border>
                        
                    </Popup>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ctrl:InfoControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ctrl:InfoControl">
                    <StackPanel
                        Orientation="Vertical"
                        Name="StackPanelPart"
                        Margin="10,50,10,50"/>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ctrl:TileLayoutControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ctrl:TileLayoutControl">
                    <Grid
                        Name="GridPart"
                        Background="{TemplateBinding Background}">
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ctrl:RacePredictorControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ctrl:RacePredictorControl">
                    <ScrollViewer 
                        VerticalScrollBarVisibility="Auto">
                        <Grid>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="Auto"/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Border
                                Grid.Row="0"
                                Background="{StaticResource RedTileBrush}"
                                CornerRadius="3"
                                Margin="2">
                                <TextBlock
                                    Style="{StaticResource InfoTextBlockStyle}"
                                    Padding="5"
                                    Text="The predictions are based upon your current fitness level and assume you have completed the appropriate training."/>
                            </Border>
                            <StackPanel
                                Grid.Row="1"
                                Name="RacePredictionsPanelPart"
                                Orientation="Vertical"
                                Margin="2,2,15,2"/>
                        </Grid>                       
                    </ScrollViewer>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
    
    <Style TargetType="ctrl:RacePredictionControl">
        <Setter Property="Margin" Value="5"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ctrl:RacePredictionControl">
                    <Border
                        CornerRadius="5"
                        Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition/>
                                <ColumnDefinition Width="150"/>
                                <ColumnDefinition Width="150"/>
                                <ColumnDefinition Width="50"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="50"/>
                            </Grid.RowDefinitions>
                            <TextBlock
                                Grid.Column="0"
                                Name="LabelTextPart"
                                VerticalAlignment="Center"/>
                            <TextBlock
                                Grid.Column="1"
                                Name="RaceTimeTextPart"
                                VerticalAlignment="Center"/>
                            <TextBlock
                                Grid.Column="2"
                                Name="PaceTextPart"
                                VerticalAlignment="Center"/>
                            <Button
                                Grid.Column="3"
                                Name="RemoveButtonPart"
                                Content="X"/>
                        </Grid>
                        <Border.Resources>
                            <Style TargetType="TextBlock">
                                <Setter Property="FontSize" Value="17"/>
                                <Setter Property="FontWeight" Value="Bold"/>
                                <Setter Property="Padding" Value="5"/>
                            </Style>
                        </Border.Resources>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ctrl:NewRacePredictionControl">
        <Setter Property="Margin" Value="5"/>
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ctrl:NewRacePredictionControl">
                    <Border
                        CornerRadius="5"
                        Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
                        <ComboBox
                            Name="DistanceComboPart">
                        </ComboBox>
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ctrl:ThresholdControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ctrl:ThresholdControl">
                    <StackPanel
                        Orientation="Vertical">
                        <ctrl:InfoControl InfoKey="ThresholdInfo"/>
                        <Grid
                            Name="ThresholdGridPart"/>
                        <StackPanel.Resources>
                            <Style TargetType="TextBlock">
                                <Setter Property="FontSize" Value="16"/>
                                <Setter Property="FontWeight" Value="Bold"/>
                                <Setter Property="HorizontalAlignment" Value="Center"/>
                            </Style>
                        </StackPanel.Resources>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="ctrl:HeartRateControl">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="ctrl:HeartRateControl">
                    <StackPanel
                        Orientation="Vertical">
                        <ctrl:InfoControl InfoKey="HeartRateInfo"/>
                        <Grid
                            HorizontalAlignment="Center">
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                                <RowDefinition/>
                                <RowDefinition/>
                                <RowDefinition/>
                                <RowDefinition/>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="180"/>
                                <ColumnDefinition Width="120"/>
                                <ColumnDefinition Width="180"/>
                                <ColumnDefinition Width="120"/>
                            </Grid.ColumnDefinitions>
                            <TextBlock
                                Grid.Row="0"
                                Text="Resting HR (BPM)"/>
                            <TextBox
                                Grid.Row="0"
                                Grid.Column="1"
                                Name="RestingHeartRatePart"
                                InputScope="Number"/>
                            <TextBlock
                                Grid.Row="0"
                                Grid.Column="2"
                                Text="Maximum HR (BPM)"/>
                            <TextBox
                                Grid.Row="0"
                                Grid.Column="3"
                                Name="MaximumHeartRatePart"
                                InputScope="Number"/>
                            <TextBlock
                                Grid.Row="1"
                                Grid.ColumnSpan="2"
                                Text="Easy: 65-79%"/>
                            <TextBlock
                                Grid.Row="2"
                                Grid.ColumnSpan="2"
                                Text="Marathon: 80-90%"/>
                            <TextBlock
                                Grid.Row="3"
                                Grid.ColumnSpan="2"
                                Text="Threshold: 88-92%"/>
                            <TextBlock
                                Grid.Row="4"
                                Grid.ColumnSpan="2"
                                Text="Interval: 98-100%"/>
                            <TextBlock
                                Grid.Row="5"
                                Grid.ColumnSpan="2"
                                Text="Repetition:"/>
                            <TextBlock
                                Grid.Row="1"
                                Grid.Column="2"
                                Grid.ColumnSpan="2"
                                Name="EasyPart"/>
                            <TextBlock
                                Grid.Row="2"
                                Grid.Column="2"
                                Grid.ColumnSpan="2"
                                Name="MarathonPart"/>
                            <TextBlock
                                Grid.Row="3"
                                Grid.Column="2"
                                Grid.ColumnSpan="2"
                                Name="ThresholdPart"/>
                            <TextBlock
                                Grid.Row="4"
                                Grid.Column="2"
                                Grid.ColumnSpan="2"
                                Name="IntervalPart"/>
                            <TextBlock
                                Grid.Row="5"
                                Grid.Column="2"
                                Grid.ColumnSpan="2"
                                Text="N/A"/>
                        </Grid>
                        <StackPanel.Resources>
                            <Style TargetType="TextBlock">
                                <Setter Property="FontSize" Value="16"/>
                                <Setter Property="FontWeight" Value="Bold"/>
                                <Setter Property="HorizontalAlignment" Value="Left"/>
                                <Setter Property="VerticalAlignment" Value="Center"/>
                            </Style>
                            <Style TargetType="TextBox">
                                <Setter Property="FontSize" Value="16"/>
                                <Setter Property="FontWeight" Value="Bold"/>
                                <Setter Property="HorizontalAlignment" Value="Left"/>
                                <Setter Property="VerticalAlignment" Value="Center"/>
                            </Style>
                        </StackPanel.Resources>
                    </StackPanel>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>